package cn.com.blueInfo.bpm.template.convert;

import cn.com.blueInfo.bpm.common.convert.BaseConvert;
import cn.com.blueInfo.bpm.template.entity.Instance;
import cn.com.blueInfo.bpm.template.request.InstanceDTO;
import cn.com.blueInfo.bpm.template.response.InstanceVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 流程运行时实例表 对象转换
 * @author suxch
 * @since 2025-08-31 16:23:18
 */
@Mapper(componentModel = "spring")
public interface InstanceConvert
        extends BaseConvert<Instance, InstanceDTO, InstanceVO> {

    Instance dtoToEntity(InstanceDTO dto);

    Instance dtoToEntity(InstanceDTO.UpdatePartialDTO dto);

    @Mapping(source = "status", target = "status", qualifiedByName = "enumToDesc")
    @Mapping(source = "deleted", target = "deleted", qualifiedByName = "enumToDesc")
    @Mapping(source = "processStatus", target = "processStatus", qualifiedByName = "enumToDesc")
    InstanceVO entityToVO(Instance entity);

}